package com.itheima.dao;

import java.util.Random;
import java.util.Scanner;

public class GuessNumber3 {
    public static void main(String[] args) {
        Random r= new Random();
        Scanner sc= new Scanner(System.in);
        int randomNum = r.nextInt(100)+1;
        while (true){
            System.out.println("请输入您猜的数据");
            int num = sc.nextInt();
            if (num>randomNum){
                System.out.println("大了,往小了猜");
            }else if (num<randomNum){
                System.out.println("小了,往大了猜");
            }else {
                System.out.println("中了中了");
                break;
            }
        }
        System.out.println("再来一局?");
    }
}
